<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "sc_total".
 *
 * @property string $t_id
 * @property integer $g_id
 * @property integer $s_id
 * @property string $t_num
 * @property string $t_total
 * @property string $t_name
 * @property string $bei2
 * @property string $bei
 *
 * @property Goods $g
 * @property Shop $s
 */
class Sctotal extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'sc_total';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['t_id', 't_num', 't_total', 't_name'], 'required'],
            [['g_id', 's_id'], 'integer'],
            [['t_num', 't_total'], 'number'],
            [['t_id'], 'string', 'max' => 10],
            [['t_name'], 'string', 'max' => 30],
            [['bei2', 'bei'], 'string', 'max' => 255]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            't_id' => '统计ID',
            'g_id' => '商品ID',
            's_id' => '客户ID',
            't_num' => 'T Num',
            't_total' => 'T Total',
            't_name' => 'T Name',
            'bei2' => 'Bei2',
            'bei' => 'Bei',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getG()
    {
        return $this->hasOne(Goods::className(), ['g_id' => 'g_id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getS()
    {
        return $this->hasOne(Shop::className(), ['s_id' => 's_id']);
    }
}
